let pool = require('../db')

let query = (sql) => {
  return new Promise((resolve, reject) => {
    pool.getConnection(function(err, connection) {
      if (err) throw err
      connection.query(sql, function (error, results, fields) {
        connection.release()
        if (error) throw error
        resolve(results)
      })
    })
  })
}

module.exports = { query }